{{-- 如果当前类目有 children 字段并且children 字段不能为空 --}}
{{-- 这是一个无限级分类 --}}
@if(isset($category['children']) && count($category['children']) > 0)
    <li class="dropdown-submenu">
        <a href="{{ route('products.index',['category_id' => $category['id']]) }}" class="dropdown-toggle" data-toggle="dropdown">
            {{ $category['name'] }}
        </a>
        <ul class="dropdown-menu">
            {{-- 遍历当前类目的子类目，递归调用自己这个模板 --}}
            @each('layouts._category_item',$category['children'],'category')
        </ul>
    </li>
@else
    <li>
        <a href="{{ route('products.index',['category_id' => $category['id']]) }}">
            {{ $category['name'] }}
        </a>
    </li>
@endif